[SPARK-10245] [SQL] Fix decimal literals with precision < scale#8428
Closed
davies wants to merge 1 commit intoapache:masterfrom
Closed
[SPARK-10245] [SQL] Fix decimal literals with precision < scale#8428davies wants to merge 1 commit intoapache:masterfrom
davies wants to merge 1 commit intoapache:masterfrom
Conversation
|
Test build #41550 has finished for PR 8428 at commit
|
Contributor
|
LGTM. Merging to master and branch 1.5. |
Contributor
|
btw, it will be good to add a comment to explain why we do a |
asfgit
pushed a commit
that referenced
this pull request
Aug 25, 2015
In BigDecimal or java.math.BigDecimal, the precision could be smaller than scale, for example, BigDecimal("0.001") has precision = 1 and scale = 3. But DecimalType require that the precision should be larger than scale, so we should use the maximum of precision and scale when inferring the schema from decimal literal.
Author: Davies Liu <davies@databricks.com>
Closes #8428 from davies/smaller_decimal.
(cherry picked from commit ec89bd8)
Signed-off-by: Yin Huai <yhuai@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In BigDecimal or java.math.BigDecimal, the precision could be smaller than scale, for example, BigDecimal("0.001") has precision = 1 and scale = 3. But DecimalType require that the precision should be larger than scale, so we should use the maximum of precision and scale when inferring the schema from decimal literal.